<?php
class Product_Model_Order
{

	private $_table;
	//Initalizing Db Table  
	public function __construct(){
		$this->_table = new Product_Model_DbTable_Order();
	}
	/**
	* 根据产品查询未发货的订单
	*
	*/
	public function getByProductId($productId){
		
		$select = $this->_table->getAdapter()->quoteInto("select count(*) from orders,order_product where orders.orders_code = order_product.orders_code and orders.orders_status in(1,2,3,4) and order_product.product_id = ?",$productId);
		return $this->_table->getAdapter()->fetchOne($select);
	}
}